import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.*;

public class Main {

    public static void main(String[] args) {

        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9};

        System.out.println("正常遍历：");
        for (int a : arr) {
            System.out.print(a + " ");
        }
        System.out.println("===============");
        System.out.println("倒着遍历,直接写法：");
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.print(arr[i] + " ");
        }
        System.out.println("===============");
        System.out.println("倒着遍历,间接写法：");
        for (int i = 0; i < arr.length; i++) {
            int j = arr.length - i - 1;
            System.out.print(arr[j] + " ");
        }
        System.out.println("===============");
        System.out.println("特殊课题：双指针遍历首尾收缩遍历");


    }


}
